<template>
    <div class="container">
        <Divider orientation="left">设定条件</Divider>
        <div v-for="(item,index) in whereList" :key="index" class="tag-box">
            <Form :model="item" label-position="right">
            <Row>
                <Col span="24">
                    <FormItem prop="tj_content" label="条件内容:">
                        {{item.tj_content}}
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem prop="tj_xian_zhi" label="条件限制:">
                        <span v-if="item.tj_xian_zhi==1">必要</span>
                        <span v-if="item.tj_xian_zhi==2">联合</span>
                        <span v-if="item.tj_xian_zhi==3">附加</span>
                    </FormItem>
                </Col>
                <Col span="24">
                    <FormItem prop="tj_yi_ju" label="条件依据:">
                        {{item.tj_yi_ju}}
                    </FormItem>
                </Col>
                <Col span="12" v-if="item.tj_xian_zhi == 2">
                    <FormItem prop="lh_yi_ju" label="联合规则:">
                        {{item.lh_yi_ju}}
                    </FormItem>
                </Col>
            </Row>
            <br/>
            <br/>
            </Form>
        </div>
        <br/>
    </div>
</template>

<script>
import { selectByNode } from '@/api/setting'
export default {
  name: 'WhereDetail',
  data () {
    return {
      whereList: [],
      baseID: ''
    }
  },
  props: {
    nodeId: {
      type: String,
      default: () => {
        return ''
      }
    }
  },
  methods: {
    success (val) {
      val = this.$common.xeUtils.isEmpty(val) ? '操作成功' : val
      this.$Message.success(val)
    },
    error (data) {
      this.$Message.error({
        content: '操作失败,\n' + data.errmsg
      })
    },
    getInfoByID () {
      const param = { base_info_id: this.baseID, gov_flow_id: this.nodeId }
      selectByNode('GovWhere', param).then(ret => {
        let data = ret.data
        if (data.errcode === 0) {
          this.whereList = data.data
        } else {
          this.error(data)
        }
      })
    }
  },
  mounted () {
    this.baseID = this.$route.query.id
    this.getInfoByID()
  }
}
</script>

<style scoped>
    .container {
        padding: 20px;
    }
</style>
